<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>构造ajax请求访问服务器</title>
</head>
<body>
    <!--使用这个页面来构造ajax请求-->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <script>
        $.ajax({
            type: 'post',
            // url: 'method', //使用相对路径
            url: '/servletHello2/method', //绝对路径：
            success: function(body){
                console.log(body) //此处的body即是HTTP响应报文里的body
            }
        })
    </script>
</body>
</html>